#include "namedPipe.hpp"

int main()
{
    // 打开管道文件
    std::cout << "client is running ..." << std::endl;
    int writeFd = open(PATH_NAME, O_WRONLY);
    std::cout << "client run finished" << std::endl;
    if(writeFd < 0) exit(1);// fd == -1

    // 写入数据
    char buffer[1024];
    while(true)
    {
        std::cout << "please say: ";
        fgets(buffer, sizeof(buffer) - 1, stdin);
        ssize_t n = write(writeFd, &buffer, strlen(buffer));
        assert(n == strlen(buffer));
        (void)n;
    }
    close(writeFd);

    return 0;
}